import request from '/@/utils/request'
import type { Language, LanguageQuery, LanguageForm } from '/@/types/language'

// 获取语言列表
export function getLanguageList(params: LanguageQuery) {
  return request<{
    list: Language[]
    total: number
  }>({
    url: '/admin/language/getList',
    method: 'get',
    params
  })
}

// 添加语言
export function addLanguage(data: LanguageForm) {
  return request({
    url: '/admin/language/doAdd',
    method: 'post',
    data
  })
}

// 编辑语言
export function editLanguage(language_id: number, data: LanguageForm) {
  return request({
    url: '/admin/language/doEdit',
    method: 'post',
    data: {
      language_id,
      ...data
    }
  })
}

// 删除语言
export function deleteLanguage(language_id: number) {
  return request({
    url: '/admin/language/doDelete',
    method: 'post',
    data: { language_id }
  })
} 